<?php
$lang = switch_language($this->uri->segment(1));
$news_link = get_url_by_lang($lang, 'news');
?>
<div class="side_item">
    <div class="title"><?php echo __('IP_Lastest_news'); ?></div>
    <div class="hp_news">
        <?php
        if (isset($news) && count($news) > 0) :
            $i = 1;
            foreach ($news as $item) {
                $thumbnail = ($item->thumbnail != '') ? $item->thumbnail : '/images/noimage.jpg';
                $uri = get_base_url() . url_title(trim($item->category), 'dash', TRUE) . '/' . url_title(trim($item->title), 'dash', TRUE) . '-n' . $item->cat_id . '-' . $item->id;
                $created_date = date('d/m/Y', strtotime($item->created_date));
                ?>
                <div class="item">
                    <div>
                        <?php
                        if ($i <= 2) {
                            ?>
                            <a href="<?php echo $uri; ?>"><img class="frame img" title="<?php echo $item->title; ?>" alt="<?php echo $item->title; ?>" src="<?php echo $thumbnail; ?>"></a>
                        <?php }
                        ?>
                        <a href="<?php echo $uri; ?>" class="title"><?php echo $item->title; ?></a>
                        <p><?php echo shorten_str(strip_tags($item->summary), MAXLENGHT_HP_NEWS_DESCRIPTION); ?></p>
                    </div>
                </div>
                <?php
                if ($i % 2 == 0 && $i != (count($news)))
                    echo '<div class="breakline"></div>';
                $i++;
            }
        endif;
        ?>
        <div class="clear"></div>
        <a href="<?php echo $news_link;?>" style="margin-left: 25px;margin-bottom: 10px;" class="button"><?php echo __('IP_view_more'); ?></a>
        <div class="breakline"></div>
    </div>
</div>

<div class="title">TIN CẬP NHẬT</div>
<div class="content lastest_news">
    <div class="item">
        <a href="#">Lorem ipsum dolor sit amet</a>
        <p>
            Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
            sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
            Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
        </p>
    </div>
    <div class="item">
        <a href="#">Lorem ipsum dolor sit amet</a>
        <p>
            Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
            sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
            Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
        </p>
    </div>
    <div class="item">
        <a href="#">Lorem ipsum dolor sit amet</a>
        <p>
            Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
            sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
            Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
        </p>
    </div>
</div>